package ch.eureka.zuul;

import ch.eureka.zuul.filter.AccessTokenFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Hello world!
 *
 */
@EnableZuulProxy
@SpringBootApplication
@RestController
public class ZuulApplication
{
    @Bean
    public AccessTokenFilter accessTokenFilter(){
        return new AccessTokenFilter();
    }

    @RequestMapping(value = "/hello")
    public String hello(){
        return "zuul local-service return";
    }

    /**
     *  请求accessToken的过滤
     *  也可以用@Component 形式，就无需bean
     * @param args
     */
    public static void main( String[] args )
    {
        SpringApplication.run(ZuulApplication.class);
    }
}
